﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Data;
using UIT.ScrumTool.Client.ControlService;


namespace UIT.ScrumTool.Client.Controller
{
    public class ProjectCtrl
    {
        #region Thuoc Tinh
        //lay kenh Project
        private static ControlService.ProjectServiceClient projectServiceClient = new ControlService.ProjectServiceClient();
        //private DataRow dataRow = null;
        #endregion

        public static DataTable TableProject()
        {
            try
            {
                DataTable data = new DataTable();
                return data;
            }
            catch (Exception)
            {
                return null;
            }
        }

        public static List<ProjectDto> ProjectGetByAll()
        {
            try
            {
                return projectServiceClient.ProjectGetByAll().ToList();
            }
            catch (Exception)
            {
                return null;
            }
        }

        public static ProjectDto ProjectGetById(int id)
        {
            try
            {
                return projectServiceClient.ProjectGetById(id);
            }
            catch (Exception)
            {
                return null;
            }
        }

        public static List<ProjectDto> ProjectGetByTop(string top, string where, string order)
        {
            try
            {
                return projectServiceClient.ProjectGetByTop(top, where, order).ToList<ProjectDto>();
            }
            catch (Exception)
            {
                return null;
            }
        }

        public static int ProjectInsert(ProjectDto project)
        {
            try
            {
                return projectServiceClient.ProjectInsert(project);
            }
            catch (Exception)
            {
                return -1;
            }
        }

        public static bool ProjectUpdate(ProjectDto project)
        {
            try
            {
                return projectServiceClient.ProjectUpdate(project);
            }
            catch (Exception)
            {
                return false;
            }
        }

        public static bool ProjectDelete(int id)
        {
            try
            {
                return projectServiceClient.ProjectDelete(id);
            }
            catch (Exception)
            {
                return false;
            }
        }

        public static int ProjectCount()
        {
            try
            {
                return projectServiceClient.ProjectCount();
            }
            catch (Exception)
            {
                return 0;
            }
        }
    }
}
